package com.mj.fragment;

import android.content.Intent;
import android.view.View;

import com.mj.R;
import com.mj.activity.Activity_BigPics;
import com.mj.activity.Activity_Detail;
import com.mj.adapter.PicAdapter;
import com.mj.base.BaseFragment;
import com.mj.view.MultiColumnListView;
import com.mj.view.PLA_AdapterView;
import com.mj.view.PLA_AdapterView.OnItemClickListener;

public class Fragment_Pic extends BaseFragment {

	@Override
	protected int getID() {
		return R.layout.fragment_pic;
	}

	@Override
	protected void editView() {
		final Activity_Detail activity_Detail = (Activity_Detail) baseActivity;
		if (activity_Detail.albums.size() != 0) {
			MultiColumnListView listView = (MultiColumnListView) viewGroup.findViewById(R.id.list);
			listView.setOnItemClickListener(new OnItemClickListener() {
				@Override
				public void onItemClick(PLA_AdapterView<?> parent, View view, int position, long id) {
					Intent intent = new Intent(baseActivity, Activity_BigPics.class);
					intent.putExtra("position", position);
					intent.putExtra("albums", activity_Detail.albums);
					intent.putExtra("title", activity_Detail.avatar.getNickname());
					startActivity(intent);
				}
			});
			PicAdapter adapter = new PicAdapter(baseActivity, activity_Detail.albums);
			listView.setAdapter(adapter);
		}
	}

	@Override
	public void setUserVisibleHint(boolean isVisibleToUser) {
	}
}
